<template>
	<view class="conntainer">
		<view class="form">
			<!-- 基础用法，不包含校验规则 -->
			<uni-forms ref="baseForm" :model="baseFormData" labelWidth="80px">
				<uni-forms-item label="性别" required>
					<uni-data-checkbox v-model="baseFormData.sex" :localdata="sexs" />
				</uni-forms-item>
				<uni-forms-item label="年龄" required>
					<uni-easyinput type="number" class="shortInput" v-model="baseFormData.ageLow" />
					~
					<uni-easyinput type="number" class="shortInput" v-model="baseFormData.ageHigh" />
					岁
				</uni-forms-item>
				<uni-forms-item label="学历要求" required>
					<uni-data-picker v-model="baseFormData.education" :localdata="education" popup-title="学历"/>
				</uni-forms-item>
				<uni-forms-item label="身高" required>
					<uni-easyinput type="number" class="shortInput" v-model="baseFormData.heightLow" />
					~
					<uni-easyinput type="number" class="shortInput" v-model="baseFormData.heightHigh" />
					cm
				</uni-forms-item>
				<uni-forms-item label="车辆情况" required>
					<uni-data-picker v-model="baseFormData.car" :localdata="car" popup-title="车辆情况">
					</uni-data-picker>
				</uni-forms-item>
				<uni-forms-item label="住房情况" required>
					<uni-data-picker v-model="baseFormData.house" :localdata="house" popup-title="住房情况" />
				</uni-forms-item>
				<uni-forms-item label="其他要求">
					<uni-easyinput  type="textarea" v-model="baseFormData.other" />
				</uni-forms-item>
			</uni-forms>

			<view class="submit"> 
				<button type="primary" @click="submit('valiForm')">修改</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				baseFormData: {
					name: '',
					ageLow: '',
					ageHigh: '',
					heightHigh:'',
					heightLow:'',
					sex: '',
					car: '',
					house: '',
					agree: '',
					education:''
				},
				sexs: [{
					value: 0,
					text: '男'
				}, {
					value: 1,
					text: '女'
				}],
				car: [{
						value: 0,
						text: '无车'
					},
					{
						value: 1,
						text: '有车有贷'
					},
					{
						value: 2,
						text: '有车无贷'
					}
				],
				house: [{
						value: 0,
						text: '无房'
					},
					{
						value: 1,
						text: '有房有贷'
					},
					{
						value: 2,
						text: '有房无贷'
					}
				],
				education: [{
						value: 0,
						text: '初中及以下'
					},
					{
						value: 1,
						text: '专科'
					},
					{
						value: 2,
						text: '本科'
					},
					{
						value: 3,
						text: '硕士'
					},
					{
						value: 4,
						text: '博士及以上'
					},
				]
			};
		}
	}
</script>

<style lang="less" scoped>
	* {
		box-sizing: border-box;
	}

	.shortInput {
		width: 50px;
		margin: 0 15px;
		flex: 0;

		&:first-child {
			margin-left: 0px;
		}

		::v-deep {
			.uni-easyinput__content {
				width: 50px;
			}
		}
	}

	.form {
		padding: 15px;
		background: #fff;
		min-height: 100%;
		width: 100%;
	}

	.container {
		background: #fff;
	}

	.submit {
		margin-top: 80px;

		/deep/ .uni-data-checklist .checklist-group .checklist-box {
			margin-bottom: 10px;
		}

		button {
			margin-top: 10px;
		}
	}

	uni-page-body {
		background-color: #fff !important;
	}

	/deep/ .uni-forms-item__content {
		display: flex;
		align-items: center;
	}
</style>
